﻿@model KhatVongViet.Models.Article
@{
    ViewBag.Title = "Khát Vọng Việt - Chỉnh Sửa Lời Hay Ý Đẹp";
    Layout = "~/Views/Administrator/Layout.cshtml";
    <script src="../../Content/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="../../Content/ckfinder/ckfinder.js" type="text/javascript"></script>
}
<h2>
    Lời hay ý đẹp</h2>
@using (Html.BeginForm("EditQuotation", "Administrator", FormMethod.Post))
{  
    <table>
        <tr>
            <td style="vertical-align: middle;">
                Tác giả
            </td>
            <td>
                @Html.TextAreaFor(a => a.Title)
                @Html.HiddenFor(a => a.ID)
                @Html.HiddenFor(a => a.TypeID)
            </td>
        </tr>
        <tr>
            <td style="vertical-align: middle;">
                Giới thiệu
            </td>
            <td>
                @Html.TextAreaFor(m => m.Summary)
            </td>
        </tr>
        <tr style="vertical-align: middle;">
            <td>
                Upload Ảnh
            </td>
            <td>
                <input id="Images" name="Images" type="text"/>
                <input id="Browser" type="button" value="Browser Images"/>
            </td>
        </tr>
        <tr>
            <td style="vertical-align: middle;">
                Hình minh họa
            </td>
            <td>
                <img src='@Model.Image' alt="Hình minh họa" height="100" width="100">
            </td>
        </tr>
        <tr >
            <td style="vertical-align: middle;">
                Nội dung chi tiết
            </td>
            <td>
                <textarea id="Detail" name="Detail" rows="20" cols="10">
                    @Html.DisplayTextFor(a => a.Context)
                </textarea>
            </td>
        </tr>
        <tr style="vertical-align: middle;">
            <td>
            </td>
            <td>
                <input type="submit" name="Update" value="Update" />
            </td>
        </tr>
    </table>
}
<script language="javascript" type="text/javascript">
    var ckeditor;
    function createEditor(languageCode, id) {
        var editor = CKEDITOR.replace(id, { language: languageCode });
        CKFinder.setupCKEditor(null, '../../Content/ckfinder');
    }
    $(function () { createEditor('eg', 'Detail') })
</script>
<script language="javascript" type="text/javascript">
    $(function () {
        $("#Browser").click(function () {
            var ckfinder = new CKFinder();
            ckfinder.selectActionFunction = function (fileUrl) {
                $("#Images").val(fileUrl)
            };
            ckfinder.popup();
        });

    });
    
</script>
